<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ include file="../common.inc" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./js/form.js"></script>
<script type="text/javascript" src="./js/calendar.js"></script>
<script type="text/javascript">
	<!--
	function viewUserContact(id){
			<c:forEach items="${users}" var="user" >
				if(id !== ${user.id}){
					document.getElementById(${user.id}+"ck1").checked = false;
				}
					document.getElementById(id+"ck1").checked = true;
		</c:forEach>
			var startDate = document.getElementById("startDate").value;
			var endDate = document.getElementById("endDate").value;
			document.getElementById("fCustomerFrame").src = "./manageReport.do?action=getContractByUserid&id="+id+"&startDate="+startDate+"&endDate="+endDate;
			
	}

	function back(){
		window.location.href = "./manageReport.do";
		window.location.target = "main";
	}
	
	function createReport(){
		
		document.newsNoticeForm.action = "./manageReport.do?action=saleMonthReport";
		document.newsNoticeForm.target = "main";
		document.newsNoticeForm.submit();
		
	}
	function aaa(aaa){
		window.location.href = aaa;
		window.location.target = "main";
		}
	-->
</script>
</head>
<body>
<form name="newsNoticeForm" method="post" action="">
<table class="table_frame">
	<tr>
		<td>
			<table class="table_title2">
				<tr>
					<td>
						<table cellpadding="0" cellspacing="0" width="100%" height="100%">
							<tr>
								<td class="title_lab">分析报表</td>
								<td align="left">&nbsp;&nbsp;快速查看：
								<select onchange="aaa(this.options[this.selectedIndex].value);">
									<option>-------------请选择-------------</option>
									<option value="./manageReport.do?action=preSalePeriodReport">销售周期分析表</option>
									<option value="./manageReport.do?action=saleMonthReport">销售月度统计表</option>
									<option value="./manageReport.do?action=allCustomerDevoteAnalysis">客户贡献统计表</option>
									<option value="./manageReport.do?action=oldCustomerDevoteAnalysis">老客户贡献分析表</option>
									<option value="./manageReport.do?action=marketExpandsAnalysis">市场开拓同步分析表</option>
									<option value="./manageReport.do?action=annualWreathCompares">年度环比分析表</option>
									<option value="./manageReport.do?action=getLinkManMailInfo">联系人邮件列表</option>
									<option value="./manageReport.do?action=CustomerStatisticContract">按客户统计合同</option>
									<option value="./manageReport.do?action=saleStatisticContract">按销售统计合同</option>
									</select>	
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr><td style="height: 55px;text-align: center;font-weight: bold;font-size: 24px;">销售月度统计报表</td></tr>
				<tr>
					<td align="center">
						<table class="table_report1" cellpadding="0" cellspacing="0" height="100%" style="width: 95%;" >
							<tr>
								<td align="right">统计周期：</td>
								<td align="left">
								
									<input id="startDate" name="startDate" class="input_report2" type="text" 
										onclick="calendar(this,'yyyy-MM-dd');" readonly="readonly" 
										value="<fmt:formatDate value='${manageReport.startDate}' pattern='yyyy-MM-dd'/>"/>
									到
									<input id="endDate" name="endDate" class="input_report2" type="text" 
										onclick="calendar(this,'yyyy-MM-dd');" readonly="readonly" 
										value="<fmt:formatDate value='${manageReport.endDate}' pattern='yyyy-MM-dd'/>"/>
								</td>
							</tr>
							<tr>
								<td align="center" height="30" colspan="2">
									<input class="btn_report" type="button" value="" onclick="createReport()"/>&nbsp;&nbsp;
									<button class="btn_back" onclick="back()" hidefocus="true">返回</button>
								</td>
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td align="center">
						<table class="table">
							<tr>
								<td>
									<div id="d" style="width:98%;height:300px;overflow-y: scroll;overflow-x: hidden;text-align: center">
										<table class="table_sreport" style="width: 95%;">
											<tr>
												<td class="title">选择</td>
												<td class="title">销售代表</td>
												<td class="title">业绩指标</td>
												<td class="title">业绩达成</td>
												<td class="title">回款毛利金额</td>
												<td class="title">完成比例</td>
												<td class="title">签约金额</td>
												<td class="title">签约毛利金额</td>
												<td class="title">回款金额</td>
												<td class="title">应收账款</td>
												<td class="title">应收账款毛利</td>
												<td class="title">费用金额</td>
											</tr>
											<c:forEach items="${users}" var="user" >
												<tr onmouseover="onmousemoveChange(this,'img${item.id}')" onmouseout="onmouseoutChange(this,'img${item.id}')">
													<td><input type="radio" id="${user.id }ck1" onclick="viewUserContact(${user.id })"></td>
													<td><a href="javascript:viewUserContact(${user.id });">${user.userName }</a></td>
													<td>￥<fmt:formatNumber value="${user.salePeriodReport.businessTarget }" pattern="###,###,###,###.##"/></td>
													<td>￥
													<c:choose>
														<c:when test="${!empty user.salePeriodReport.finishCost}">
															<fmt:formatNumber value="${user.salePeriodReport.finishCost }" pattern="###,###,###,###.##"/>
														</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
													</td>
													<td>
													￥
														<c:choose>
														<c:when test="${!empty user.salePeriodReport.grossBackCost}">
															<fmt:formatNumber value="${user.salePeriodReport.grossBackCost }" pattern="###,###,###,###.##"/>
															</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
													</td>
													<td><fmt:formatNumber value="${user.salePeriodReport.finishRate}" pattern="############.##"/>%</td>
													<td>￥
													<c:choose>
														<c:when test="${!empty user.salePeriodReport.contractCost}">
															<fmt:formatNumber value="${user.salePeriodReport.contractCost }" pattern="###,###,###,###.##"/>
														</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
													</td>
													<td>
													￥
													<c:choose>
														<c:when test="${!empty user.salePeriodReport.contractGross}">
															<fmt:formatNumber value="${user.salePeriodReport.contractGross}" pattern="###,###,###,###.##"/>
														</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
													</td>
													<td>￥
														<c:choose>
														<c:when test="${!empty user.salePeriodReport.backCost}">
															<fmt:formatNumber value="${user.salePeriodReport.backCost }" pattern="###,###,###,###.##"/>
														</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
													</td>
													<td>￥
													<c:choose>
														<c:when test="${!empty user.salePeriodReport.receivable}">
															<fmt:formatNumber value="${user.salePeriodReport.receivable }" pattern="###,###,###,###.##"/>
														</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
													</td>
													<td>
													￥
														<c:choose>
														<c:when test="${!empty user.salePeriodReport.receivableGross}">
														<fmt:formatNumber value="${user.salePeriodReport.receivableGross }" pattern="###,###,###,###.##"/>
														</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
													</td>
													<td>￥
														<c:choose>
														<c:when test="${!empty user.salePeriodReport.saleCost}">
															<fmt:formatNumber value="${user.salePeriodReport.saleCost }" pattern="###,###,###,###.##"/>
														</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
													</td>
												</tr>
											</c:forEach>
											<tr>
												<td></td>
												<td>合计：</td>
												<td>￥
												<c:choose>
														<c:when test="${!empty totalSalePeriodReport.businessTarget}">
															<fmt:formatNumber value="${totalSalePeriodReport.businessTarget}" pattern="###,###,###,###.##"/>
														</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
												</td>
												<td>￥
												<c:choose>
														<c:when test="${!empty totalSalePeriodReport.finishCost}">
															<fmt:formatNumber value="${totalSalePeriodReport.finishCost}" pattern="###,###,###,###.##"/>
														</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose></td>
												<td>
												￥
													<c:choose>
														<c:when test="${!empty totalSalePeriodReport.grossBackCost}">
												<fmt:formatNumber value="${totalSalePeriodReport.grossBackCost }" pattern="###,###,###,###.##"/>
													</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
												</td>
												<td><fmt:formatNumber value="${totalSalePeriodReport.finishRate}" pattern="############.##"/>%</td>
												<td>￥
													<c:choose>
														<c:when test="${!empty totalSalePeriodReport.contractCost}">
															<fmt:formatNumber value="${totalSalePeriodReport.contractCost }" pattern="###,###,###,###.##"/>
														</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
												</td>
												<td>￥
												<c:choose>
														<c:when test="${!empty totalSalePeriodReport.contractGross}">
															<fmt:formatNumber value="${totalSalePeriodReport.contractGross}" pattern="###,###,###,###.##"/>
														</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
												</td>
												<td>￥
												<c:choose>
														<c:when test="${!empty totalSalePeriodReport.backCost}">
															<fmt:formatNumber value="${totalSalePeriodReport.backCost }" pattern="###,###,###,###.##"/>
														</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
												</td>
												<td>￥
													<c:choose>
														<c:when test="${!empty totalSalePeriodReport.receivable}">
															<fmt:formatNumber value="${totalSalePeriodReport.receivable }" pattern="###,###,###,###.##"/>
														</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
												</td>
												<td>
												￥
													<c:choose>
														<c:when test="${!empty totalSalePeriodReport.receivableGross}">
															<fmt:formatNumber value="${totalSalePeriodReport.receivableGross }" pattern="###,###,###,###.##"/>
														</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
												</td>
												<td>￥
													<c:choose>
														<c:when test="${!empty totalSalePeriodReport.saleCost}">
															<fmt:formatNumber value="${totalSalePeriodReport.saleCost }" pattern="###,###,###,###.##"/>
														</c:when>
														<c:otherwise>
															0
														</c:otherwise>
													</c:choose>
												</td>
											</tr>
										</table>
									</div>
								</td>
							</tr>
							
							<tr>
								<td align="center"><br/>
									<iframe style="text-align: center;" src="" id="fCustomerFrame" name="fCustomerFrame" frameborder="0" scrolling="auto" width="95%" 
										></iframe>
								</td>
							</tr>
						</table>
				
					</td>
				</tr>
				
			</table>
		</td>
	</tr>
</table>
	
		
</form>
</body>
</html>